home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 November: Tool Chest / Dev.CD Nov 00 TC Disk 2.toast / pc / sample code / quicktime / basics / draganddrop shell / dtsqtutilities.h < prev    next >
Encoding:
Text File  |  2000-09-28  |  7.7 KB  |  167 lines

  1. /*
  2.     File:        DTSQTUtilities.h
  3.  
  4.     Contains:    QuickTime functions, header file definitions.
  5.  
  6.     Written by:     
  7.  
  8.     Copyright:    Copyright © 1994-1999 by Apple Computer, Inc., All Rights Reserved.
  9.  
  10.                 You may incorporate this Apple sample source code into your program(s) without
  11.                 restriction. This Apple sample source code has been provided "AS IS" and the
  12.                 responsibility for its operation is yours. You are not permitted to redistribute
  13.                 this Apple sample source code as "Apple sample source code" after having made
  14.                 changes. If you're going to re-distribute the source, we require that you make
  15.                 it clear in the source that the code was descended from Apple sample source
  16.                 code, but that you've made changes.
  17.  
  18.     Change History (most recent first):
  19.                 7/28/1999    Karl Groethe    Updated for Metrowerks Codewarror Pro 2.1
  20.                 
  21.  
  22. */
  23.  
  24. // Define that this file should only be parsed once, most dev environments know of pragma once.
  25. #pragma once
  26.  
  27.  
  28. // INCLUDES
  29. #include <Gestalt.h>
  30. #include <GestaltEqu.h>
  31. #include <TextUtils.h>
  32. #include <Errors.h>
  33. #include <SegLoad.h>
  34. #include <Printing.h>
  35. #include <Sound.h>
  36.  
  37. #include <Movies.h>
  38. #include "MoviesFormat.h"
  39. #include <Components.h>
  40. #include <QuickTimeComponents.h>
  41. #include <FixMath.h>
  42.  
  43. #include <stdio.h>
  44.  
  45. #ifdef __cplusplus
  46. extern "C" {
  47. #endif
  48.  
  49.  
  50. // Window size constants.
  51. enum eQTUWindowSize {
  52.     kNormalMovieSize = 1L,
  53.     kHalfMovieSize,
  54.     kDoubleMovieSize
  55. };
  56.  
  57.  
  58. // Rate constant values, Fwd = forward, Bwd = backwards.
  59. enum eQTUMovieRates {    kNoSpeed = 0x00000000,  kFwdSpeed = 0x00010000,
  60.                                         kFwdDoubleSpeed = 0x00020000, kFwdTripleSpeed = 0x00030000,    
  61.                                         kFwdQuadSpeed = 0x00040000, kFwdHalfSpeed = 0x00008000, 
  62.                                         kFwdQuarterSpeed = 0x00004000, kFwdEightspeed = 0x00002000, 
  63.                                         kBwdSpeed = 0xFFFF0000, kBwdDoubleSpeed = 0xFFFE0000, 
  64.                                         kBwdHalfSpeed = 0xFFFF8000 };
  65.  
  66.  
  67. // Constants used for QTUPrintMoviePICT.
  68. enum eQTUPICTPrinting { kPrintFrame = 1, kPrintPoster };
  69.  
  70.  
  71. // MACROS
  72. #if DEBUG
  73. static char gDebugString[256];
  74.  
  75. #define DebugAssert(condition)                                                                        \
  76.         if (condition)        NULL;                                                                            \
  77.     else                                                                                                             \
  78.     {                                                                                                                \
  79.         sprintf(gDebugString,"File: %s, Line: %d", __FILE__, __LINE__);            \
  80.         DebugStr(c2pstr(gDebugString));                                                            \
  81.     }
  82. #else
  83. #define DebugAssert(condition)        NULL
  84. #endif
  85.  
  86. #define MBSTARTTIMER() DebugStr("\pStart! `;mc starttime @ticks;g")
  87. #define MBSTOPTIMER()    DebugStr("\pElapsed time in ticks: '; @ticks - starttime")
  88.  
  89.  
  90. // ReturnIfError is a simple macro around the frequently written code line doing the same (see below)
  91. #define ReturnIfError(theError)  DebugAssert(theError == noErr);  \
  92.                                                     if(theError != noErr) return theError
  93.  
  94.  
  95. // FUNCTION PROTOTYPES
  96.  
  97.  
  98.  
  99. // MOVIE TOOLBOX FUNCTIONS
  100. pascal Boolean             QTUIsQuickTimeInstalled(void);                                                                                        // Check if QT is present.
  101.  
  102. #ifdef powerc
  103. pascal Boolean             QTUIsQuickTimeCFMInstalled(void);                                                                                // Check if QT CFM library is present.
  104. #endif // powerc
  105.  
  106. pascal long                 QTUGetQTVersion();                                                                                                        // Get QT version number.
  107. pascal Boolean             QTUAreQuickTimeMusicInstrumentsPresent(void);                                                            // Test if Musical Instrumentscomponent is present.
  108.  
  109. pascal OSErr                QTUPrerollMovie(Movie theMovie);                                                                                // Preroll Movies before Playback.
  110.  
  111. pascal Boolean             QTUFileFilter(ParmBlkPtr theParamBlock);
  112. pascal Movie             QTUGetMovie(FSSpec *theFSSpec, short *theRefNum, short *theResID);                        // Return a Movie from a file with the movie.
  113. pascal OSErr             QTUSimpleGetMovie(Movie *theMovie);                                                                        // Simpler version of querying for a movie and return it.
  114. pascal OSErr             QTUSaveMovie(Movie theMovie);                                                                                    // Save the movie (standard dialog box).
  115. pascal OSErr                QTUFlattenMovieFile(Movie theMovie, FSSpec *theFile);                                                // Takes a movie and a file and flattens the movie into the file.
  116. pascal OSErr                QTUPrintMoviePICT(Movie theMovie, short x, short y, long PICTUsed);                           // Print the movie poster.
  117. pascal OSErr                QTUCalculateMovieMemorySize(Movie theMovie, long *theSize);                                    // Return the size of the movie in memory.
  118. pascal OSErr                QTULoadWholeMovieToRAM(Movie theMovie);                                                                // Load the whole movie to RAM.
  119. pascal OSErr                QTUPlayMovieSound(Movie theMovie);                                                                            // Play the movie sound track using the snd resource.
  120. pascal OSErr                QTUDrawVideoFrameAtTime(Movie theMovie, TimeValue atTime);                                    // Draw a movie frame at specified time.
  121. pascal OSErr             QTUScrollToNextVideoSample(Movie theMovie, TimeValue fromTimePoint, 
  122.                                                                                 TimeValue toTimePoint);                                                // Do a visible scroll from one video frame to another.
  123.  
  124. pascal OSErr             QTUGetStartPointOfFirstVideoSample(Movie theMovie,TimeValue *startPoint);                // Get time value of first sample in the movie.
  125.  
  126. // TRACK & MEDIA
  127. pascal Boolean             QTUMediaTypeInTrack(Movie theMovie, OSType theMediaType);                                    // Check if a Media type is present in a track of a movie.
  128. pascal OSErr                QTUGetTrackRect(Track theTrack, Rect *theRect);                                                        // Get the track rect of a possible video track
  129. pascal short                 QTUGetVideoMediaPixelDepth(Media theMedia, short index);                                            // Get the pixel depth of a video media.
  130. pascal long                QTUCountMediaSamples(Movie theMovie, OSType theMediaType);                                    // Count frames in a movie based on defined media.
  131. pascal TimeValue          QTUGetDurationOfFirstMovieSample(Movie theMovie, OSType theMediaType)    ;                // Get duration of first sample in the track
  132. pascal OSErr             QTUCountMaxSoundRate(Movie theMovie,long *theMaxSoundRate);                                // Return max sound rate from a sound track in a movie.
  133. pascal long                 QTUGetMovieFrameCount(Movie theMovie, long theFrameRate);                                        // Return frames based on frame rate and movie.
  134. pascal OSErr             QTUCopySoundTracks(Movie theSrcMovie, Movie theDestMovie);                                    // Copy sound tracks from source movie to destination movie
  135.  
  136.  
  137. // IMAGE COMPRESSION MANAGER
  138. Boolean                     QTUHasCodecLossLessQuality(CodecType theCodec, short thePixelDepth);                        // Test if a codec has lossless spatial compression.
  139.  
  140.  
  141. // MOVIE CONTROLLER FUNCTIONS
  142. pascal OSErr             QTUPlayMovieWithMC(MovieController mc);                                                                    // Play the movie using the movie controllers.
  143. pascal OSErr              QTUDoIgnoreMCDrags(MovieController  mc);                                                                    // ignore Drag-and-Drop functionality.
  144. pascal Boolean            QTUPointInMC(MovieController mc, WindowRef theWindow, Point where);                    // Check if a point is inside the movie controller rect.
  145. pascal OSErr             QTUSelectAllMovie(MovieController mc);                                                                        // Select the whole time frame from a movie with the mc.
  146. pascal Boolean             QTUResizeMCActionFilter(MovieController mc, short action, void *params, long refCon);
  147. pascal OSErr             QTUResizeMCWindow(MovieController mc, WindowPtr theWindow, long theMovieSize,  Rect originalSize);
  148.  
  149. pascal OSErr                QTUMCSetMovieRate(MovieController mc, long theRate);                                                // Set movie rate using movie controller.
  150.  
  151.  
  152. // SEQUENCE GRABBER FUNCTIONS
  153. pascal SeqGrabComponent QTUCreateSequenceGrabber(WindowPtr theWindow);                                                // Create a sequence grabber instance.
  154. pascal OSErr                     QTUCreateSGGrabChannels(SeqGrabComponent s, const Rect *theBounds, 
  155.                                             long theUsage, SGChannel *theVideoChannel, SGChannel *theSoundChannel);         // Create sequence grabber channels.
  156. pascal Boolean                     QTUDoesVDIGReceiveVideo(SeqGrabComponent s);                                                    // Do we have live incoming video?
  157. pascal OSErr                     QTUChangeSGWindowSize(SeqGrabComponent s,SGChannel videoChannel,                 // Change the window size of Sequence Grabber window
  158.                                             WindowPtr theWindow, long width, long height);
  159.  
  160. // COMPONENT FUNCTIONS
  161. pascal Component         QTUDoGetComponent(OSType theComponentType, OSType theSpecificComponent);
  162. pascal Boolean             QTUHasComponentType(OSType theComponentType, OSType theSpecificComponent);
  163.  
  164.  
  165. #ifdef __cplusplus
  166. }
  167. #endif